from django.urls import path, re_path, include
from web.views import account, home, project, statistics, wiki, file, setting, issues, dashboard

urlpatterns = [
    path('register/', account.register, name='register'),
    path('send/sms/', account.sned_sms, name='send_sms'),
    path('login/sms/', account.login_sms, name='login_sms'),
    path('login/', account.login, name='login'),
    path('logout/', account.logout, name='logout'),
    path('image/code/', account.image_code, name='image_code'),

    path('index/', home.index, name='index'),
    path('price/', home.price, name='price'),
    path('payment/<policy_id>/', home.payment, name='payment'),
    path('pay/', home.pay, name='pay'),
    path('pay/notify/', home.pay_notify, name='pay_notify'),

    path('invite/join/<code>/', issues.invite_join, name='invite_join'),  # 邀请成功后跳转至该页面

    # 项目列表
    path('project/list/', project.project_list, name='project_list'),
    path('project/star/<project_type>/<project_id>/', project.project_star, name='project_star'),
    path('project/unstar/<project_type>/<project_id>/', project.project_unstar, name='project_unstar'),
    path('manage/<project_id>/', include([
        re_path('manage/dashboard/issues/chart/', dashboard.issues_chart, name='issues_chart'),
    ])),
    # 概览管理
    path('manage/<project_id>/dashboard/', dashboard.dashboard, name='dashboard'),

    # 问题管理
    path('manage/<project_id>/issues/', issues.issues, name='issues'),
    path('manage/<project_id>/issues/detail/<issues_id>/', issues.issues_detail, name='issues_detail'),
    path('manage/<project_id>/issues/record/<issues_id>/', issues.issues_record, name='issues_record'),
    path('manage/<project_id>/issues/change/<issues_id>/', issues.issues_change, name='issues_change'),
    path('manage/<project_id>/issues/invite/', issues.invite_url, name='invite_url'),

    # 统计管理
    path('manage/<project_id>/statistics/', statistics.statistics, name='statistics'),
    path('manage/<project_id>/statistics/priority/', statistics.statistics_priority, name='statistics_priority'),
    path('manage/<project_id>/statistics/project/user/', statistics.statistics_project_user, name='statistics_project_user'),

    # 文件管理
    path('manage/<project_id>/file/', file.file, name='file'),
    path('manage/<project_id>/file/delete/', file.file_delete, name='file_delete'),
    path('manage/<project_id>/cos/credential/', file.cos_credential, name='cos_credential'),
    path('manage/<project_id>/file/post/', file.file_post, name='file_post'),
    path('manage/<project_id>/file/download/?<file_id>/', file.file_download, name='file_download'),

    # wiki管理
    path('manage/<project_id>/wiki/', wiki.wiki, name='wiki'),
    path('manage/<project_id>/wiki/add/', wiki.wiki_add, name='wiki_add'),
    path('manage/<project_id>/wiki/catalog/', wiki.wiki_catalog, name='wiki_catalog'),
    path('manage/<project_id>/wiki/delete/<wiki_id>/', wiki.wiki_delete, name='wiki_delete'),
    path('manage/<project_id>/wiki/edit/<wiki_id>/', wiki.wiki_edit, name='wiki_edit'),
    path('manage/<project_id>/wiki/upload/', wiki.wiki_upload, name='wiki_upload'),

    # 配置管理
    path('manage/<project_id>/setting/', setting.setting, name='setting'),
    path('manage/<project_id>/setting/delete/', setting.delete, name='setting_delete'),

]
